We don't get a focus-out on the event controller, when
the surface is losing keyboard focus, since we are not
moving our focus to some other widget, so we are never
unsetting the mnemonics-visible property. Do that in
response to surface state changes instead.
priv->state = new_surface_state;
if (changed_mask & GDK_SURFACE_STATE_FOCUSED)
- ensure_state_flag_backdrop (widget);
+ {
+ gboolean focused = new_surface_state & GDK_SURFACE_STATE_FOCUSED;
+
+ ensure_state_flag_backdrop (widget);
+
+ _gtk_window_set_is_active (window, focused);
+
+ if (!focused)
+ gtk_window_set_mnemonics_visible (window, FALSE);
+ }
if (changed_mask & GDK_SURFACE_STATE_FULLSCREEN)
{